﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using IHISCETeim.Library;

namespace IHISCETeim.BLL
{
    public class BaseController : DataCacheKey
    {
        private static volatile DataCache instance = null;
        private static object lockHelper = new object();
        /// <summary>
        /// 缓存对象
        /// </summary>
        public static DataCache DC
        {
            get
            {
                if (instance == null)
                {
                    lock (lockHelper)
                    {
                        if (instance == null)
                        {
                            instance = DataCache.Instance();
                        }
                    }
                }
                return instance;
            }
        }


        /// <summary>
        /// 获取缓存键字,匹配相应参数
        /// </summary>
        /// <param name="key"></param>
        /// <param name="param"></param>
        /// <returns></returns>
        public static string GetDataCacheKey(string key, params object[] param)
        {
            if (param.Length <= 0)
                return key;
            if (string.IsNullOrEmpty(key))
                return "";
            return string.Format(key, param);
        }
    }
}
